package com.zhen.controller;

import com.zhen.domain.Book;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: zhen-desktop
 * Date: 2019/1/25
 * Time: 21:00
 */
@Controller
@RequestMapping("/json")
public class BookController {

    @RequestMapping("/testRequestBody")
    @ResponseBody
    public Object getJson(){
        List<Book> list = new ArrayList<>();
        list.add(new Book(1,"Spring MVC 企业应用实战","肖文吉"));
        list.add(new Book(2,"轻量级Java EE 企业应用实战","李刚"));
        return list;
    }

}
